From: Jonas Dreßler Date: Thu, 24 Jul 2025 17:47:58 +0000 (+0200) Subject: st/theme-node: Free properties array on dispose rather than finalize X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~88^2~9^2^2~10 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=1bb045aeab31b7cf8af1b796b00e806f955acbc6;p=gnome-shell.git st/theme-node: Free properties array on dispose rather than finalize We're going to use `g_object_run_dispose()` on StThemeNode with the next commit in order to manually clear the properties array and a few other things when the StThemeContext changes. That's because after theme context changes, the CSS properties will no longer be valid, and accessing them will cause crashes. Even if St behaves nicely and throws out all theme nodes on theme context changes, there might still be users holding references to nodes, so we want to ensure that the old nodes are harmless after theme context changes. Part-of: (cherry picked from commit 07d6cf017eedfa02059848b33a5412576ac023c6) --- diff --git a/src/st/st-theme-node.c b/src/st/st-theme-node.c index 4e0111d4f..8fbb71a10 100644 --- a/src/st/st-theme-node.c +++ b/src/st/st-theme-node.c @@ -102,6 +102,7 @@ st_theme_node_dispose (GObject *gobject) st_theme_node_paint_state_free (&node->cached_state); + maybe_free_properties (node); g_clear_object (&node->theme); G_OBJECT_CLASS (st_theme_node_parent_class)->dispose (gobject); @@ -117,8 +118,6 @@ st_theme_node_finalize (GObject *object) g_strfreev (node->pseudo_classes); g_free (node->inline_style); - maybe_free_properties (node); - g_clear_pointer (&node->font_desc, pango_font_description_free); g_clear_pointer (&node->box_shadow, st_shadow_unref);